<template>
    <div>
        <mt-cell title="手机账户" v-bind:value="phone"></mt-cell>
        <mt-cell title="剩余天数" v-bind:value="deadLine"></mt-cell>
        <mt-cell title="打卡状态" v-bind:value="dakaStatus"></mt-cell>
        <mt-cell title="健康打卡时间，一周中哪几天打卡" v-bind:value="healTimeDay"></mt-cell>
        <mt-cell title="晚上打卡时间，一周中哪几天打卡" v-bind:value="nightTimeDay"></mt-cell>
        <mt-cell title="早上打卡时间" v-bind:value="healTime"></mt-cell>
        <mt-cell title="晚上打卡时间" v-bind:value="nightTime"></mt-cell>
        <mt-cell title="devicetoken" v-bind:value="deviceToken"></mt-cell>
        <mt-cell title="app版本" v-bind:value="appVersion"></mt-cell>
        <mt-cell title="axy-token" v-bind:value="axyToken"></mt-cell>
    </div>
</template>

<script>
export default {
    name: 'UserInfo',
    data() {
        return {
            phone: '',
            deadLine: '',
            dakaStatus: true,
            healTimeDay: '',
            nightTimeDay: '',
            healTime: '',
            nightTime: '',
            deviceToken: '',
            appVersion: '',
            axyToken: ''
        }
    },
    methods: {
        getMainInfo() {
            fetch(this.url+"/user/userdetailinfo",{
                credentials: 'include',
                method: 'POST'
            })
            .then((res)=>{return res.text()})
            .then((value)=>{
                value = JSON.parse(value);
                this.phone = value["data"][0].phone;
                this.deadLine = value["data"][0].dateline;
                if(value["data"][0].markornot == 1){
                    this.dakaStatus = true;
                } else {
                    this.dakaStatus = false;
                }
                this.healTimeDay = value["data"][0].healweek;
                this.nightTimeDay = value["data"][0].week;
                this.healTime = value["data"][0].morningclock;
                this.nightTime = value["data"][0].nightclock;
                this.deviceToken = value["data"][0].devicetoken;
                this.appVersion = value["data"][0].appversion;
                this.axyToken = value["data"][0].axy_token;
                // console.log(value);
            }).catch(function(err) {
                console.error(err);
            });
        }
    },
    mounted() {
        this.getMainInfo()
    }
}
</script>

<style scoped>
</style>